package command

import (
	"fmt"

	"github.com/spf13/cobra"
)

var StopCmd = &cobra.Command{
	Use:   "stop",
	Short: fmt.Sprintf("stop %s service", Name),
	Long:  fmt.Sprintf("stop %s service", Name),
	Run: func(cmd *cobra.Command, args []string) {
		stop()
	},
}

func stop() error {
	err := SRV.Stop()
	if err != nil {
		if err != nil {
			fmt.Printf("Failed to stop %v,error:%v\n", Name, err)
			return err
		} else {
			fmt.Printf("Succeed to stop service %v\n", Name)
		}
	}
	return nil
}
